<?php

use yii\helpers\Url;

return [
    [
        'class' => 'kartik\grid\CheckboxColumn',
        'width' => '20px',
    ],
    [
        'class' => 'kartik\grid\SerialColumn',
        'width' => '30px',
    ],
    [
        'class' => '\kartik\grid\DataColumn',
        'attribute' => 'username',
    ],
    [
        'class' => '\kartik\grid\DataColumn',
        'attribute' => 'email',
    ],
    [
        'class' => 'kartik\grid\EditableColumn',
        'attribute' => 'status',
        'value' =>function($model){
            return $model->status == 1?'可用':'不可用';
        },
        'editableOptions' => [
            'header' => '状态',
            'inputType' => \kartik\editable\Editable::INPUT_RADIO_LIST,
            'data' =>  [1 => '可用', 2 => '不可用'],
            'formOptions' => ['action' => ['change-status']]
        ],
        'pageSummary' => true
    ],    
    [
        'class' => 'kartik\grid\ActionColumn',
        'dropdown' => false,
        'vAlign' => 'middle',
        'urlCreator' => function($action, $model, $key, $index) {
            return Url::to([$action, 'id' => $key]);
        },
        'viewOptions' => ['role' => 'modal-remote', 'title' => Yii::t('common', 'View'), 'data-toggle' => 'tooltip'],
        'updateOptions' => ['role' => 'modal-remote', 'title' => Yii::t('common', 'Update'), 'data-toggle' => 'tooltip'],
        'deleteOptions' => ['role' => 'modal-remote', 'title' => Yii::t('common', 'Delete'),
            'data-confirm' => false, 'data-method' => false, // for overide yii data api
            'data-request-method' => 'post',
            'data-toggle' => 'tooltip',
            'data-confirm-title' => Yii::t('common', 'Are you sure?'),
            'data-confirm-message' => Yii::t('common', 'Are you sure want to delete this item'),
        ]
    ],
];
